/*
 * main.cc
 *
 *  Created on: Nov 27, 2010
 *      Author: fify
 */

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

class NodeX
{
public:
	int x, y;

	bool operator <(const NodeX n) const
	{
		return x < n.x;
	}
};

class NodeY
{
public:
	int x, y;

	bool operator <(const NodeY n) const
	{
		return y < n.y;
	}
};

NodeX x_node[205];
NodeY y_node[205];

inline int area(int x_btm, int x_ceil, int y_btm, int y_ceil)
{
	//printf("%d %d %d %d\n", x_node[x_btm].x, x_node[x_ceil].x, y_node[y_btm].y, y_node[y_ceil].y);
	return (x_node[x_ceil].x - x_node[x_btm].x + 2) * (y_node[y_ceil].y
			- y_node[y_btm].y + 2);
}

void solve()
{
	int n, m;
	scanf("%d%d", &n, &m);

	for (int i = 0; i < n; i++)
	{
		scanf("%d%d", &x_node[i].x, &x_node[i].y);
		y_node[i].x = x_node[i].x;
		y_node[i].y = x_node[i].y;
	}

	sort(x_node, x_node + n);
	sort(y_node, y_node + n);

	int x_btm, x_ceil;
	int y_btm, y_ceil;

	int count;

	x_btm = x_ceil = 0;

	int result = 0x7fffffff;

	for (; x_btm < n; x_btm++)
	{
		// Including the ceil node.
		for (x_ceil = x_btm; x_ceil < n; x_ceil++)
		{
			if (x_ceil - x_btm + 1 < m)
				continue;

			count = 0;

			for (y_btm = y_ceil = 0; y_btm < n;y_btm++)
			{
				// Excluding the ceiling node.
				for (; y_ceil <= n; y_ceil++)
				{
					if (count >= m)
					{
						result
								= min(result,
										area(x_btm, x_ceil, y_btm, y_ceil - 1));
						break;
					}

					if(y_ceil == n)
						break;

					if (y_node[y_ceil].x >= x_node[x_btm].x && y_node[y_ceil].x
							<= x_node[x_ceil].x)
						++count;
				}

				if (y_node[y_btm].x >= x_node[x_btm].x && y_node[y_btm].x
						<= x_node[x_ceil].x)
					count--;
			}
		}
	}

	printf("%d\n", result);
}

int main()
{
	int t;
	scanf("%d", &t);

	while (t--)
	{
		solve();
	}

	return 0;
}
